from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

driver = webdriver.Edge()
driver.get("file:///D:/QQ(%E6%96%B0%E7%89%88)/%E6%96%87%E4%BB%B6/confirm.html")
driver.maximize_window()
sleep(2)

driver.find_element(By.ID,'button').click()
sleep(2)
alert = driver.switch_to.alert
# alert.accept()
alert.dismiss()

sleep(5)